#—*—coding:utf-8 -*-
#@Time        :2022/7/16 22:44
#@Author      :dhx
#@File        :could_pay_receivingorder.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from time import  sleep

from pages.base_pageage import BasePage
class CollectReceive(BasePage):
    url="http://192.168.1.120/crm/index.php?m=finance&a=index&t=receivingorder"
    people_locator = (By.ID, 'owner_name')  # 负责人
    option_person_locator = (By.XPATH, '//*[@id="d_content"]/tr[1]/td[1]/input')  # 选择负责人
    ok_person_locator = (By.XPATH, '/html/body/div[8]/div[3]/div/button[1]/span')  # 点击保存
    person_locator = (By.ID, 'receivables')  # 收款人
    option_locator = (By.XPATH, '//*[@id="data"]/tr/td[1]/input')  # 选择应收款
    save_person_locator = (By.XPATH, '/html/body/div[7]/div[3]/div/button[1]/span')  # 点击保存
    price_locator = (By.ID, 'money')  # 金额
    time_locator = (By.ID, 'pay_time')  # 收款时间
    status_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tbody/tr[7]/td[2]/input[1]')  # 收款状态
    desc_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tbody/tr[8]/td[2]/textarea')  # 描述
    f_save_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tfoot/tr/td[2]/input[1]')  # 最后保存

    def option_person(self):
        """选择负责人"""
        self.driver.find_element(*self.people_locator).click()
        sleep(1)

    def first_option(self):
        """勾选第一个"""
        self.driver.find_element(*self.option_person_locator).click()
        sleep(1)

    def save_person(self):
        """保存"""
        self.driver.find_element(*self.ok_person_locator).click()
        sleep(1)
    def prrson_col(self):
        """选择收款人"""
        self.driver.find_element(*self.person_locator).click()
        sleep(1)

    def f_col(self):
        """第一个收款人"""
        self.driver.find_element(*self.option_locator).click()
        sleep(1)

    def col_save(self):
        """保存收款人"""
        self.driver.find_element(*self.save_person_locator).click()
        sleep(1)

    def inpu_money(self):
        """输入金额"""
        self.driver.find_element(*self.price_locator).send_keys("1000")
        sleep(1)

    def time_col(self):
        """输入收款时间"""
        self.driver.find_element(*self.time_locator).send_keys("2022-08-10")
        sleep(1)

    def status_col(self):
        """选择状态"""
        self.driver.find_element(*self.status_locator).click()
        sleep(1)

    def desc_col(self):
        """输入描述"""
        self.driver.find_element(*self.desc_locator).send_keys("描述")
        sleep(1)

    def save_col(self):
        """点击保存"""
        self.driver.find_element(*self.f_save_locator).click()
        sleep(1)






